package com.atguigu.algorithm;

public class TheMostNumInTheBox {
    public static void main(String[] args) {
        System.out.println(countBalls(5, 15));
        System.out.println(countBalls(19,28));
    }
    public static int countBalls(int lowLimit,int highLimit){
        int[] a=new int[highLimit];
        for(int i=lowLimit;i<=highLimit;i++){
            a[count(i)]++;
        }
        int max=0;
        for(int i=0;i<a.length;i++){
            if(a[i]>max){
                max=a[i];
            }
        }
        return max;
    }
    public static int count(int n){
        int ret=0;
        while(n!=0){
            ret+=n%10;
            n/=10;
        }
        return ret;
    }
}
